package com.siwei.mes.enums;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;

import java.util.Arrays;

/**
 * 是否甲供
 *
 * @Description: 是否甲供
 * @Version: 1.0
 * @author: yangke
 * @date: 2025/5/17 22:31
 */
@Getter
public enum SelfSupplyEnum {
    NO(0, "否"),
    YES(1, "是");
    @ApiModelProperty(value = "配置类型")
    private Integer code;
    @ApiModelProperty(value = "类型名称")
    private String name;

    SelfSupplyEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    /**
     * 根据code查找信息
     *
     * @param code 物料类型
     * @return
     */
    public static SelfSupplyEnum selectByCode(Integer code) {
        return Arrays.stream(values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
    }
}
